#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020/4/18 20:52|20:52
# @Author  : yangdingyi
# @File    : 11. 盛最多水的容器.2020-04-18
# @Software: PyCharm
from typing import List


class Solution:
    def maxArea(self, height: List[int]) -> int:
        ll = len(height)
        m, l, r = 0, 0, ll - 1
        while l < r:
            v = min(height[l], height[r]) * (r - l)
            if v > m:
                m = v
            if height[l] > height[r]:
                r -= 1
            elif height[l] < height[r]:
                l += 1
            else:
                l, r = l + 1, r - 1
        return m


solve = Solution()
hh = [1, 8, 6, 2, 5, 4, 8, 3, 7]
print(hh)
print(solve.maxArea(hh))


